#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
using namespace std;
void Print(int v)
{
	cout<<"<"<<v<<">";
}
bool LessThen4(int n)
{
	return n<4&&n>2;
}
int main()
{
	cout<<"1) "<<min(3,4)<<","<<max(2.5,8.3)<<endl;
	int a[9] = {1,2,3,4,5,3,4,4,4};
	cout<<"2) "<< * min_element(a,a+9)<<","<< * max_element(a,a+9)<<endl;
	
	cout<<"3) "<<count(a,a+9,4)<<endl;
	cout<<"4) "<<count_if(a,a+9,LessThen4)<<endl;
	
	list<int>lst(a,a+9);
	int b[2] = {4,3};
	vector<int>v(b,b+2);
	list<int>::iterator p;
	p = find_first_of(lst.begin(),lst.end(),b,b+2);
	cout<<"5) "<<distance(lst.begin(),p)<<endl;
	reverse(v.begin(),v.end());
	int *ptr = find_end(a,a+9,v.begin(),v.end());
	
	cout<<"6) "<<distance(a,ptr)<<endl;
	p = adjacent_find(lst.begin(),lst.end());
	cout<<"7) "<< * p <<","<<distance(lst.begin(),p)<<endl;
	p = search(lst.begin(),lst.end(),v.begin(),v.end());
	cout<<"8) "<<distance(lst.begin(),p)<<endl;
	ptr = search_n(a,a+9,2,4);
	cout<<"9) "<<distance(a,ptr)<<endl;
	cout<<boolalpha;
	cout<<"10) "<<equal(v.begin(),v.end(),a+2)<<endl;
	
	int c[6] = {1,2,3,9,7,8};
	pair<int *,int *>result;
	result = mismatch(c,c+6,a);
	cout<<"11) "<<* result.first<<","<<* result.second<<endl;
	cout<<"12) "<<lexicographical_compare(a,a+9,c,c+6)<<endl;
	for_each(a,a+3,Print);
	return 0;
}